package com.yellowpage.nsp.listener;

import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Timer;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

public class FetchNSPLoggerListener implements ServletContextListener {
    Timer timer=new Timer();

    public void contextInitialized(ServletContextEvent event){        

        long delayTime =  300000 - System.currentTimeMillis() % 300000;

        //整5分开始, 隔5分钟
        timer.schedule(new FetchNSPLoggerTask(),delayTime,300000);
    }

    public void contextDestroyed(ServletContextEvent event){
        timer.cancel();
    }

}

